FROM php:7.4.33-fpm

RUN apt-get update \
    && apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev \
    && docker-php-source extract  \
    && docker-php-ext-configure gd --with-jpeg=/usr/include --with-freetype=/usr/include/ \
    && docker-php-ext-install gd \
    && docker-php-ext-enable gd

RUN pecl install redis \
    docker-php-ext-install redis \
    && docker-php-ext-enable redis

#RUN pecl install mongodb \
#    docker-php-ext-install mongodb \
#    && docker-php-ext-enable mongodb

RUN docker-php-ext-install pdo_mysql \
    && docker-php-ext-enable pdo_mysql

RUN apt-get install -y libzip-dev libzip4 \
    && docker-php-ext-install zip

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
    && php composer-setup.php \
    && php -r "unlink('composer-setup.php');" \
    && mv composer.phar /usr/local/bin/composer \
    && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini

CMD ["php-fpm"]
